import json

# 加载数据
with open("today_data_20250716.json", "r", encoding="utf-8") as f:
    data = json.load(f)

code = data.get('code')
msg = data.get('message')
data = data.get('data', [])

for item in data:
    # 股票名称
    stock_chi_name = item.get('stock_chi_name')

    # 检查surge_reason是否为None
    surge_reason = item.get('surge_reason')
    related_plates = surge_reason.get('related_plates', []) if surge_reason else []

    # 获取符号并拆分
    symbol_get = item.get('symbol', "")
    symbol_split = symbol_get.split('.')

    if len(symbol_split) == 2:  # 确保分割后的格式正确
        symbol_prefix = symbol_split[0]
        symbol_sufix = symbol_split[1]
        # 股票代码
        symbol = symbol_sufix + symbol_prefix

        for rel in related_plates:
            plate_id = rel.get('plate_id', "")
            plate_name = rel.get('plate_name', "")
            print(symbol,plate_id, plate_name)
    else:
        print(f"警告: 符号格式不正确: {symbol_get}，在股票: {stock_chi_name}")